<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBannersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('banners', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('ID');
            $table->string('title', '50')->index()->nullable()->comment('标题');
            $table->text('images_url')->nullable()->comment('图片url');
            $table->string('mold', '10')->index()->nullable()->comment('跳转类型 page:小程序内部页面、unlink:不跳转、program:其他小程序、web:H5页面');
            $table->text('link')->nullable()->comment('跳转链接');
            $table->string('appid', '50')->index()->nullable()->comment('第三方小程序appid，"mold":"program"时必须');
            $table->integer('store_id')->index()->nullable()->comment('门店ID');
            $table->integer('sort')->index()->nullable()->comment('排序（同级有效）');
            $table->integer('status')->index()->default(1)->comment('状态：1.正常，2.禁用');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('banners');
    }
}
